package com.gaojinqi.service.impl;

import com.gaojinqi.dataobject.ProductCategory;
import com.gaojinqi.repository.ProductCategoryRepository;
import com.gaojinqi.service.CategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Optional;

/**
 * 类目
 *
 * @author gaojinqi
 * @date 2019/4/30 23:55
 */
@Service
public class CategoryServiceImpl implements CategoryService {

    @Autowired
    private ProductCategoryRepository categoryRepository;

    @Override
    public Optional<ProductCategory> findOne(String categoryId) {
        return categoryRepository.findById(categoryId);
    }

    @Override
    public List<ProductCategory> findAll() {
        return categoryRepository.findAll();
    }

    @Override
    public List<ProductCategory> findByCategoryTypeIn(List<Integer> categortyTypeList) {
        return categoryRepository.findByCategoryTypeIn(categortyTypeList);
    }

    @Override
    public ProductCategory save(ProductCategory productCategory) {
        return categoryRepository.save(productCategory);
    }
}
